package cn.tedu.controller;

import cn.tedu.service.SearchService;
import com.jt.common.pojo.Product;
import org.apache.lucene.index.IndexReader;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class SearchController {
    @Autowired
    public SearchService searchService;
    @RequestMapping("/search/manage/query")
    public List<Product> search(@RequestParam("query") String text ,Integer page,Integer rows){
        //非空判断
        if(page==null||rows==null){
            page=1;
            rows=5;
        }
        return searchService.search(text,page,rows);
    }
}
